﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace ContosoUniversity.Controllers
{
    public class ProxyController : Controller
    {
        //https://www.mgenware.com/blog/?p=334
        // GET: Proxy
        [HttpGet]
        public async Task<ActionResult> Index()
        {
            var httpClient = new HttpClient();
            var uriBuilder = new UriBuilder(Request["reqUrl"]);
            var res = await  httpClient.GetAsync(uriBuilder.Uri);

            return Content(await res.Content.ReadAsStringAsync());
        }

        public ActionResult Test()
        {
            return View();
        }
    }
}